import React, { Component } from 'react';
import Headbox from './header';
// 引入路由
import { BrowserRouter } from 'react-router-dom';
import './index.css';
// 引用登录页
import Login from './login';
import Main from './mian';
// 引入antd框架
import { Layout } from 'antd';
const { Header, Content } = Layout;

export default class index extends Component {
  constructor() {
    super();
    this.state = {
      num: 'login'
    };
  }
  cilckLogin = a => {
    this.setState({
      num: a
    });
  };
  render() {
    return (
      <BrowserRouter>
        {this.state.num === 'login' ? (
          <Login handlelogin={this.cilckLogin} />
        ) : (
          <Layout>
            <Header>
              <Headbox />
            </Header>
            <Content>
              <Main />
            </Content>
          </Layout>
        )}
      </BrowserRouter>
    );
  }
}
